<template>
  <el-table
    :data="userList.filter(data=>data.type)"
    style="width: 100%">
    <slot name="date"></slot> 
    <el-table-column
      label="昵称"
      prop="nickname">
    </el-table-column>
    <el-table-column
      label="联系方式"
      prop="phone">
    </el-table-column>
    <el-table-column
      label="操作">
      <template slot-scope="scope">
        <el-button
          size="mini"
          :disabled="$store.state.user.type!=0"
          @click="reset(scope.row.id)">重置密码</el-button>
        <el-button
          size="mini"
          type="danger"
          :disabled="$store.state.user.type!=0"
          @click="del(scope.row.id)">删除用户</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import{resetPass,delUser} from "@/api/user"
  export default {
      props:["userList","onDelList"],
    data() {
      return {
        
      }
    },
    methods: {
      reset(id){
          resetPass(id).then(res=>{
              console.log(res,"res")
          })
      },
      async del(id){
          let res=await delUser(id)
          this.onDelList(id)
      }
    },
  }
</script>
<style scoped>
  
  .el-table_1_column_1 img{
    border-radius: 50%;
  }
</style>